XQuery Source of a Logical Entity Service
This page last changed on Nov 28, 2008.
Oracle Data Service Integrator Documentation > Data Services Developer's Guide XQuery Source of a Logical Entity ServiceThis topic shows sample XQuery source code for a logical entity data service. TopicsSource Codexquery version "1.0" encoding "UTF-8"; (::pragma xds <x:xds targetType="cus:CUSTOMER_PROFILE" xmlns:x="urn:annotations.ld.oracle.com" xmlns:cus="ld:logical/CustomerProfile"> <creationDate>2007-10-05T10:29:01</creationDate> <userDefinedView/> <key name="DefaultKey" inferred="true" inferredSchema="true" type="cus:CustomerProfile_KEY"> <selector xpath="CUSTOMER"/> </key> </x:xds>::) import schema namespace cus="ld:logical/CustomerProfile" at "ld:logical/schemas/CustomerProfile.xsd"; declare namespace cus1= "ld:physical/CUSTOMER"; declare namespace add= "ld:physical/ADDRESS"; declare namespace cre= "ld:physical/CREDITRATING"; import schema namespace cus2="ld:logical/CustomerProfile" at "ld:logical/schemas/CustomerProfile_KEY.xsd"; declare namespace tns="ld:logical/CustomerProfile"; declare function tns:stringToShort($theString) as xs:short { xs:short($theString) }; (::pragma function <f:function kind="read" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.oracle.com"> <uiProperties> <component identifier="returnNode" minimized="false" x="842" y="11" w="244" h="601"> <treeInfo id="0"> <collapsedNodes> <collapsedNode>CUSTOMER_PROFILE\CUSTOMER</collapsedNode> <collapsedNode>CUSTOMER_PROFILE\CUSTOMER\ADDRESS</collapsedNode> <collapsedNode>CUSTOMER_PROFILE\CUSTOMER\CREDITRATING</collapsedNode> </collapsedNodes> </treeInfo> </component> <component identifier="CUSTOMER" x="44" y="56" h="300" w="219" minimized="false"/> <component identifier="ADDRESS" x="303" y="216" h="336" w="193" minimized="false"/> <component identifier="CREDITRATING" x="547" y="485" h="102" w="170" minimized="false"/> </uiProperties> </f:function>::) declare function tns:read() as element(tns:CUSTOMER_PROFILE)*{ for $CUSTOMER in cus1:CUSTOMER() return <tns:CUSTOMER_PROFILE> <CUSTOMER> <CUSTOMER_ID>{fn:data($CUSTOMER/CUSTOMER_ID)}</CUSTOMER_ID> <FIRST_NAME>{fn:data($CUSTOMER/FIRST_NAME)}</FIRST_NAME> <LAST_NAME>{fn:data($CUSTOMER/LAST_NAME)}</LAST_NAME> <EMAIL_ADDRESS>{fn:data($CUSTOMER/EMAIL_ADDRESS)}</EMAIL_ADDRESS> { for $ADDRESS in add:ADDRESS() where $CUSTOMER/CUSTOMER_ID eq $ADDRESS/CUSTOMER_ID return <ADDRESS> <ADDR_ID>{fn:data($ADDRESS/ADDR_ID)}</ADDR_ID> <CUSTOMER_ID>{fn:data($ADDRESS/CUSTOMER_ID)}</CUSTOMER_ID> <STREET_ADDRESS1>{fn:data($ADDRESS/STREET_ADDRESS1)}</STREET_ADDRESS1> <STREET_ADDRESS2?>{fn:data($ADDRESS/STREET_ADDRESS2)}</STREET_ADDRESS2> <CITY>{fn:data($ADDRESS/CITY)}</CITY> <STATE>{fn:data($ADDRESS/STATE)}</STATE> <ZIPCODE>{fn:data($ADDRESS/ZIPCODE)}</ZIPCODE> <COUNTRY>{fn:data($ADDRESS/COUNTRY)}</COUNTRY> </ADDRESS> } { for $CREDITRATING in cre:CREDITRATING() where $CUSTOMER/CUSTOMER_ID eq $CREDITRATING/CUSTOMER_ID return <CREDITRATING> <CUSTOMER_ID>{fn:data($CREDITRATING/CUSTOMER_ID)}</CUSTOMER_ID> <RATING?>{fn:data($CREDITRATING/RATING)}</RATING> </CREDITRATING> } </CUSTOMER> </tns:CUSTOMER_PROFILE> }; (::pragma function <f:function kind="delete" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.oracle.com"> <nonCacheable/> <implementation> <updateTemplate/> </implementation> </f:function>::) declare procedure tns:deleteCUSTOMER_PROFILE($arg as element(tns:CUSTOMER_PROFILE)*) as empty() external; (::pragma function <f:function kind="create" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.oracle.com"> <nonCacheable/> <implementation> <updateTemplate/> </implementation> </f:function>::) declare procedure tns:createCUSTOMER_PROFILE($arg as element(tns:CUSTOMER_PROFILE)*) as element(tns:CustomerProfile_KEY)* external; (::pragma function <f:function kind="update" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.oracle.com"> <nonCacheable/> <implementation> <updateTemplate/> </implementation> </f:function>::) declare procedure tns:updateCUSTOMER_PROFILE($arg as changed-element(tns:CUSTOMER_PROFILE)*) as empty() external; (::pragma function <f:function kind="delete" visibility="public" isPrimary="false" xmlns:f="urn:annotations.ld.oracle.com"/>::) declare procedure tns:deleteByKey($arg0 as element(tns:CustomerProfile_KEY)){ do return (); }; See AlsoConceptsHow Tos
|
![]() |
Document generated by Confluence on Jan 13, 2009 15:57 |